package SinglyList;

public class SinglyListTest {
    public static void main(String[] args) {
        SinglyList<Integer> stringSinglyList = new SinglyList<Integer>();
        stringSinglyList.insert(31);
        stringSinglyList.insert(21);
        stringSinglyList.insert(51);
        stringSinglyList.insert(61);
        stringSinglyList.insert(71);
        stringSinglyList.insert(41);
        stringSinglyList.insert(71);
        stringSinglyList.insert(31);
        stringSinglyList.insert(1);
        stringSinglyList.insert(101);
        stringSinglyList.insert(1);
        stringSinglyList.insert(4);
        stringSinglyList.insert(9);
        System.out.println("目前的单链表为"+stringSinglyList);
//        System.out.println("使用last方法得到最后一个结点"+stringSinglyList.last());
//        System.out.println("使用prev方法得到第二个节点的前一个结点"+stringSinglyList.prev(stringSinglyList.getLocation(3)));
//        SinglyList<Integer> stringSinglyList1 = stringSinglyList.subList(2, 2);
//        System.out.println("使用subList方法得到从第二个节点开始，长度为2的子表为"+stringSinglyList1);
//        stringSinglyList.partition(stringSinglyList,1, stringSinglyList.size);
//        System.out.println("使用partition算法排序为"+stringSinglyList);
        SinglyList<Integer> compare = new SinglyList<Integer>();
        compare.insert(3);
        compare.insert(31);
        compare.insert(51);
        compare.insert(61);
        stringSinglyList.removeAll(compare);
        System.out.println("使用了removeAll方法后的链表为"+stringSinglyList);
    }
}
